import axios from 'axios'

console.log(process.env.NODE_ENV)
const isDev = process.env.NODE_ENV === 'development'

const ajax = axios.create({
  baseURL: isDev ? 'https://show.bilibili.com' : ''
})
// 请求拦截
ajax.interceptors.request.use(config => {
  console.log('请求拦截。。。')
  return config
})
// 响应拦截
ajax.interceptors.response.use(resp => {
  if (resp.errno === 0) {
    return resp
  } else {
    return 'error! errno != 0'
  }
})

const getBilibiliShop = () => {
  return axios.get('/api/ticket/project/listV2?version=134&page=1&pagesize=16&area=-1&filter=&platform=web&p_type=%E5%85%A8%E9%83%A8%E7%B1%BB%E5%9E%8B')
}

export default {
  getBilibiliShop
}
